Legend Add Method
The Legend Add method adds another item to an existing legend.
Example
plot = PLOT(/TEST, COLOR='lime')
l = LEGEND(LABEL='First Plot')
plot2 = PLOT(RANDOMU(seed,200), COLOR='purple', /OVERPLOT)
l.add, plot2, LABEL='Second Plot'
Syntax
legend.Add, TARGET [, Properties=variable]
Arguments
TARGET
One or more graphic items to be added to the existing legend.
Keywords
None
Properties
The following properties will be passed down to the newly-added legend item.
Set this property equal to a string specifying the IDL or system font. The default value is "DejaVuSans".
FONT_SIZE
Set this property equal to an integer specifying the font size. The default value is 9 points.
FONT_STYLE
A string or integer containing the font style. Allowed values are:
Integer |
String |
Resulting Style |
---|---|---|
0 |
"Normal" or "rm" |
Default (roman) |
1 |
"Bold" or "bf" |
Bold |
2 |
"Italic" or "it" |
Italic |
3 |
"Bold italic" or "bi" |
Bold italic |
LABEL
Set this property to a string giving the label for the legend item. If this property is set then the default label will not be used. Set this property to an empty string to go back to using the default label.
You can add Greek letters and mathematical symbols using a TeX-like syntax. These symbols need to be enclosed within a pair of "$" characters. See Adding Mathematical Symbols and Greek Letters to the Text String for details on the available symbols.
SAMPLE_ANGLE
The angle of the sample line or arrow, in degrees. The default value is zero, which gives a horizontal line for line plots, and a right-pointing arrow for vector plots.
SAMPLE_MAGNITUDE
Note: This keyword only applies to legend items for vector plots.
Set this property to either a case-insensitive string or a floating-point number giving the length of the sample vector. Possible values are:
- "Min" - use the smallest magnitude value as the length of the sample vector.
- "Mean" - use the mean (or average) of all of the magnitude values. This is the default.
- "Max" - use the largest magnitude value.
- a floating-point number - use that number as the length of the sample vector.
The arrow displayed in the legend is scaled to match the chosen length, relative to the maximum magnitude of the vector plot. This property is only used for legend items for vector plots, and is ignored for all other legend items.
Note: If the LABEL property is set, then the SAMPLE_MAGNITUDE will still be used to scale the length of the sample arrow, but will not be used to label the legend item. For example, if your vector data was in "miles per hour" but you wanted to display the length in "km/hr", you might set the SAMPLE_MAGNITUDE to 62, but then set the LABEL to "100 km/hr".
SAMPLE_WIDTH
The width of the line sample, in normalized units. The default value is 0.15.
For line plots, increasing the SAMPLE_WIDTH will also increase the number of plot symbols on the legend item. A sample width of 0 gives 1 plot symbol. A sample width of 0.01–0.19 gives 2 plot symbols, 0.20–0.39 gives 3 plot symbols, etc.
TEXT_COLOR
Set this property to a string or RGB vector that specifies the color of the text.
UNITS
Set this property to a string giving the units for the vector plot. This string will then be appended to the sample magnitude label in the legend item. If the LABEL property is set then this property is ignored. This property is only used for legend items for vector plots, and is ignored for all other legend items.
You can add Greek letters and mathematical symbols using a TeX-like syntax. These symbols need to be enclosed within a pair of "$" characters. See Adding Mathematical Symbols and Greek Letters to the Text String for details on the available symbols.
Version History
8.0 |
Introduced |
8.2 |
Added Legend Item properties. |